import { createRouter, createWebHistory } from 'vue-router';

import { NOT_FOUND_ROUTE, menuRoutes } from './routes';

export * from './routes';

import createRouteGuard from './guard';

const router = createRouter({
  // history: createWebHashHistory(),
  history: createWebHistory(),
  routes: [
    //默认进工作台
    {
      path: '/',
      redirect: {
        name: 'ui',
      },
      children: menuRoutes,
    },
    //未知路由
    NOT_FOUND_ROUTE,
  ],
  scrollBehavior() {
    return { top: 0 };
  },
});

createRouteGuard(router);

export default router;
